package com.zhitongyun.publics.greendao;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import com.ys.peony.database.User;
import com.ys.peony.rolecontrol.entity.Component;
import com.ys.peony.rolecontrol.entity.Info;
import com.ys.peony.rolecontrol.entity.Layout;
import com.ys.peony.rolecontrol.entity.Widget;

import com.zhitongyun.publics.greendao.UserDao;
import com.zhitongyun.publics.greendao.ComponentDao;
import com.zhitongyun.publics.greendao.InfoDao;
import com.zhitongyun.publics.greendao.LayoutDao;
import com.zhitongyun.publics.greendao.WidgetDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig userDaoConfig;
    private final DaoConfig componentDaoConfig;
    private final DaoConfig infoDaoConfig;
    private final DaoConfig layoutDaoConfig;
    private final DaoConfig widgetDaoConfig;

    private final UserDao userDao;
    private final ComponentDao componentDao;
    private final InfoDao infoDao;
    private final LayoutDao layoutDao;
    private final WidgetDao widgetDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        userDaoConfig = daoConfigMap.get(UserDao.class).clone();
        userDaoConfig.initIdentityScope(type);

        componentDaoConfig = daoConfigMap.get(ComponentDao.class).clone();
        componentDaoConfig.initIdentityScope(type);

        infoDaoConfig = daoConfigMap.get(InfoDao.class).clone();
        infoDaoConfig.initIdentityScope(type);

        layoutDaoConfig = daoConfigMap.get(LayoutDao.class).clone();
        layoutDaoConfig.initIdentityScope(type);

        widgetDaoConfig = daoConfigMap.get(WidgetDao.class).clone();
        widgetDaoConfig.initIdentityScope(type);

        userDao = new UserDao(userDaoConfig, this);
        componentDao = new ComponentDao(componentDaoConfig, this);
        infoDao = new InfoDao(infoDaoConfig, this);
        layoutDao = new LayoutDao(layoutDaoConfig, this);
        widgetDao = new WidgetDao(widgetDaoConfig, this);

        registerDao(User.class, userDao);
        registerDao(Component.class, componentDao);
        registerDao(Info.class, infoDao);
        registerDao(Layout.class, layoutDao);
        registerDao(Widget.class, widgetDao);
    }
    
    public void clear() {
        userDaoConfig.clearIdentityScope();
        componentDaoConfig.clearIdentityScope();
        infoDaoConfig.clearIdentityScope();
        layoutDaoConfig.clearIdentityScope();
        widgetDaoConfig.clearIdentityScope();
    }

    public UserDao getUserDao() {
        return userDao;
    }

    public ComponentDao getComponentDao() {
        return componentDao;
    }

    public InfoDao getInfoDao() {
        return infoDao;
    }

    public LayoutDao getLayoutDao() {
        return layoutDao;
    }

    public WidgetDao getWidgetDao() {
        return widgetDao;
    }

}
